var {
  getappointmentlist,
  deleteappointment
} = require('../../utils/api');
const methods = require('../../utils/methods');
const app = getApp();

Page({

  data: {
    list: [],
    uname:'',
  },

  onLoad: function (options) {
    let _this = this;
    if (app.globalData.userInfo) { //老用户查询
      _this.setData({
        uname:app.globalData.userInfo.name
      })
    } 
    console.log('----------进来了-------------', app.globalData.id, 200, 1)
    //页面加载时事件类型 家庭类，环保类，违章违建类....
    getappointmentlist(app.globalData.id, 20, 1).then(res => {
      console.log('res==', res);
      let ary = res[1].content;

      _this.setData({
        list: ary
      })
    })

  },

  cancel(e){
    console.log('111111', e.currentTarget.dataset.id);
    let id = e.currentTarget.dataset.id;

    deleteappointment(id).then((res)=>{

      if(res[0] == 200){
        wx.navigateBack({
          delta: 1,
        })
      }
    })
  }

})